from .base import MyBaseModelView


class ActivationCodeModelView(MyBaseModelView):
    column_list = (
        "title",
        "limit",
        "reusable",
        "uses_number",
    )

    column_labels = {
        "title": "Имя кода",
        "limit": "Лимит использований (0 - безлимитный)",
        "reusable": "Можно использовать повторно",
        "users": "Пользователи",
        "uses_number": "Использован раз",
        "subscription_type": "Тип подписки",
    }

    form_excluded_columns = (
        "uses_number",
        "subscriptions",
        "created_at",
        "updated_at",
    )

    column_editable_list = (
        "limit",
        "reusable",
    )

    column_filters = (
        "limit",
        "reusable",
        "uses_number",
        "created_at",
    )

    column_searchable_list = ("title",)

    column_default_sort = ("id", True)
